#include <nxos.h>
#include <PowerBox.h>

NX_Error PowerBoxBuiltinCd(int argc, char *argv[], char * env)
{
    NX_Error err;
    if (argc < 2)
    {
        NX_Printf("Usage:\n  cd [path]\n");
        return NX_EAGAIN;
    }
    err = PowerBoxSetCwd(argv[1]);
    if (err != NX_EOK)
    {
        NX_Printf("cd: path `%s` not exist or not a directory.\n", argv[1]);
        return err;
    }
    return NX_EOK;
}
